<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>积分兑换活动页面</title>
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="/main/css/style.css">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
</head>
<body>
<!--fixed remove-->
<section class="fixed" style="z-index:999;width: 100%;height: 100%;background-color: #000;position: fixed;left: 0;top: 0;"></section>
<section class="activity_page">
    <div class="header">
        <div class="wrap_avatar">
            <span class="avatar"><img src="{%$user.headimg|default:'/main/img/avator.jpg'%}"></span><em>{%$user.username|default:''%}</em>
        </div>
        <p class="total_point">兑换积分:<em class="font34">{%$user.intergtal|default:0%}</em></p>
    </div>

    <!--切换部分-->
    <div class="mainTab">
        <div class="main-tab-nav">
            <ul class="clearfix">
                <li><a href="/activity">亲子活动</a></li>
                <li class="current">童装试用</li>
            </ul>
        </div>
        <div class="main-tab-con">

            <!--童装试用-->
            <div class="cnt tryout">
                <div class="title title_2"></div>
                <div id="body"></div>
            </div>
        </div>
    </div>
</section>
</body>
<script src="/main/js/jquery-1.12.3.min.js"></script>
<script src="/main/js/common.js"></script>
<script src="/main/js/jquery.touchSwipe.js"></script>
<script>
    var page=1;
    $(function () {
        checkweichatevent();
        Init();

        $("body").swipe({
                //Generic swipe handler for all directions
                swipe: function (event, direction, distance, duration, fingerCount, fingerData) {

                    if (direction == 'up') {
                        page++;
                        Init()
                    }
                },
                allowPageScroll: 'vertical',
            }
        );

    })




    function Init() {

        $.ajax({
            type: "POST",
            url: "/api/getclothing.json",
            data: {page: page},
            success: function (e) {

                $.each(e.data,function (k,v) {
                    var div='';
                    if(v.pic==''){
                        div=div+'<div class="activity_item">';
                    }else{
                        div=div+'<div class="activity_item" style="background: url(/upload/'+v.pic+') 0 0 no-repeat;">';
                    }

                    div=div+'<div class="sub_title">'+v.clothing_name+'</div>';
                    div=div+'<dl>';
                    div=div+'<dd>适合年龄:'+v.minage+'-'+v.maxage+'</dd>';
                    div=div+'<dd>活动时间:'+v.starttime+'-'+v.endtime+'</dd>';
                    div=div+'<dd>可兑换:'+v.num+'组</dd>';
                    div=div+'<dd>已兑换:'+v.joinnum+'组</dd>';
                    div=div+'</dl>';
                    div=div+'<a class="bottom_btn" href="/clothing_detail/'+v.id+'">点击详情<br/>'+v.integral+'积分开启</a>';
                    div=div+'<span class="inner_bg"></span>';
                    div=div+'</div>';
                    $("#body").append(div);

                })
            }
        });


    }

</script>
</html>